Skip to content

Created a Permutation Function in the Recursion package. Closed the issue #7322#7412

Open
trynafind-sumanyu wants to merge 8 commits intoTheAlgorithms:masterfrom
trynafind-sumanyu:master
Open

Created a Permutation Function in the Recursion package. Closed the issue #7322#7412
trynafind-sumanyu wants to merge 8 commits intoTheAlgorithms:masterfrom
trynafind-sumanyu:master

Conversation

@trynafind-sumanyu
Copy link
Copy Markdown

@trynafind-sumanyu trynafind-sumanyu commented May 4, 2026

Issue #7322

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 4, 2026

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.55%. Comparing base (2616e09) to head (a8a8e13).

Files with missing lines Patch % Lines
...java/com/thealgorithms/recursion/Permutations.java 92.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7412      +/-   ##
============================================
+ Coverage     79.54%   79.55%   +0.01%     
- Complexity     7178     7186       +8     
============================================
  Files           798      799       +1     
  Lines         23467    23492      +25     
  Branches       4617     4621       +4     
============================================
+ Hits          18666    18690      +24     
- Misses         4055     4056       +1     
  Partials        746      746              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DenizAltunkapan
Copy link
Copy Markdown
Member

@trynafind-sumanyu there exists another permutation class: https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/backtracking/Permutation.java
Whats the difference between these?

@trynafind-sumanyu
Copy link
Copy Markdown
Author

Hey @DenizAltunkapan,

I wasn’t aware that a permutation implementation already existed under the backtracking package, as the issue specifically referenced the recursion package, where no such file was present. Based on that, I proceeded with adding a new implementation there.

Additionally, I introduced handling for duplicate elements to ensure that only unique permutations are generated. This behavior was not present in the existing backtracking/Permutation.java implementation.

Please let me know if you’d prefer aligning this with the existing implementation or consolidating the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants